<template>
	<el-form  :model="registerForm" label-width="80px">
	
		<el-form-item label="病人号">
			<el-input v-model="registerForm.patientId"></el-input>
		</el-form-item>
		<el-form-item label="创建时间">
			 <el-date-picker
			      v-model="registerForm.createtime"
			      type="date"
				  value-format="yyyy-MM-dd "
			      placeholder="选择日期">
			    </el-date-picker>
		</el-form-item>
		<el-form-item label="工作条件">
			<el-input v-model="registerForm.workcondition"></el-input>
		</el-form-item>
		<el-form-item label="职业">
			<el-input v-model="registerForm.job"></el-input>
		</el-form-item>
		<el-form-item label="爱好">
			<el-input v-model="registerForm.hobit"></el-input>
		</el-form-item>
		
		<el-button type="primary" @click='doRegisterAdd'>提交</el-button>
	</el-form>
</template>

<script>
	export default{
		name:'RegisterAdd',
		props:[
			'dialogVisible'
		],
		data(){
			return{
				registerForm:{
					patientId:'',
					createtime:'',
					workcondition:'',
					job:'',
					hobit:''
				}
			}
		},
		methods:{
			doRegisterAdd(){
				console.log(this.registerForm);
				this.postRequest("/register/insert",this.registerForm).then(resp=>{
					if(resp){
						this.$emit("update:dialogVisible",false);
						this.$emit("add")
					}else{
						this.$message.error({message:'添加失败'});
					}
				})
			}
		}
	}
</script>

<style>
</style>
